<template>
	<view class="container">
		<!-- 填写意见 -->
		<view class="submit-content">
			<textarea v-model="content" placeholder-style="color: rgba(64,33,16,0.50)" placeholder="请填写您的申诉内容..."/>
		</view>
		
		<!-- 提交按钮 -->
		<view class="submit" @click="handleSubmit">提交</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				content:''
			}
		},
		methods: {
			// 提交反馈
			async handleSubmit () {
				if (this.content == '') return uni.showToast({ title: '请填写申诉内容', icon: 'none' })
				let reason = {
					'reason':this.content
				}
				let res = await this.$fetch(this.$api.explainApply, reason , 'POST','JSON')
				if (res.code) return uni.showToast({ title: res.msg, icon: 'none' })
				uni.showToast({ title: '提交成功~', icon: 'none' })
				let timer = setTimeout(() => {
					clearTimeout(timer);
					timer = null;
					uni.navigateBack();
				}, 500);
			},
		}
	}
</script>

<style lang="less">
	.container {
		overflow: hidden;
		
		.submit-content {
			background: #FFFFFF;
			margin-top: 30rpx;
			padding: 30rpx;
			display: flex;
			flex-direction: column;
			
			textarea {
				width: 690rpx;
				height: 400rpx;
				font-size: 14px;
				line-height: 1.8;
			}
		}
		.submit {
			position: fixed;
			bottom: 0;
			left: 0;
			width: 100vw;
			height: 100rpx;
			background: #FCC928;
			display: flex;
			justify-content: center;
			align-items: center;
			
			&:active {
				opacity: 0.7;
			}
		}
	}

</style>
